/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * 
 * Project Name:lmrp-api
 * Create Time: 2016年3月3日 上午9:45:26
 */
package com.lenovo.lmrp.api.itsmgateway;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.MediaType;

/**
 * Separate stream operation from normal request, because that implementation is complex more,
 * may need multi-thread, async and so on. 
 * Some time for safe-thread, we need to create new instance from every request
 * 
 * @author wujin
 * @version v1.0
 */
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces("application/json;charset-utf-8")
public interface IItsmStream {
    /**
     * Upload ticket attachment from mobile app or website
     * 
     * @param itsmcode
     * @param ticketid
     * @param attachmentid
     * @param asyncResponse
     */
    @POST
    @Path("/{itsmcode}/tickets/{ticketid}/attachments/{attachmentid}")
    public void uploadAttachment(@PathParam("itsmcode") String itsmcode,
                               @PathParam("ticketid") String ticketid,
                               @PathParam("attachmentid") String attachmentid,
                               @Suspended AsyncResponse asyncResponse);
    
    /**
     * Import data to initialize system
     * 
     * @param itsmCode
     * @param entity, can be: project, engineer, sp, client, etc.
     * @param asyncResponse
     */
    @POST
    @Path("/{itsmcode}/syncdata/{entity}")
    public void importEntityData(@PathParam("itsmcode") String itsmCode, 
                                 @PathParam("entity") String entity,
                                 @Suspended AsyncResponse asyncResponse);
}
